<%@tag import="java.sql.SQLException"%>
<%@tag import="java.sql.DriverManager"%>
<%@tag import="java.sql.Connection"%>

<%@ attribute name="test" %>

<%
    Connection con = (Connection) request.getSession().getAttribute("currentConnection");
    if (con != null && con.isClosed()) {
        con = null;
    }
    if (con == null && (getJspContext().getAttribute("test")==null || getJspContext().getAttribute("test")!="") ) {
        Class.forName("org.postgresql.Driver");
        String url = "jdbc:postgresql:JKHBase";
        String username = "postgres";
        String password = "masterkey";
        con = DriverManager.getConnection(url, username, password);
        request.getSession().setAttribute("currentConnection", con);
    }
%>